Only pass -Zincremental to nightly rustc.
authorJon Gjengset <jon@thesquareplanet.com>
Sat, 6 May 2017 22:31:10 +0000 (18:31 -0400)
committerJon Gjengset <jon@thesquareplanet.com>
Sat, 6 May 2017 22:31:23 +0000 (18:31 -0400)
Fixes #3835

src/cargo/ops/cargo_rustc/context.rs

index 27cd369ba6df1f9a83b993e98bebdbcf82f42281..0dc584ccd3fefde190760132817861c66f8421f7 100644 (file)
@@ -83,6 +83,14 @@ impl<'a, 'cfg> Context<'a, 'cfg> {
             Err(_) => false,
         };
 
+        // -Z can only be used on nightly builds; other builds complain loudly.
+        // Since incremental builds only work on nightly anyway, we silently
+        // ignore CARGO_INCREMENTAL on anything but nightly. This allows users
+        // to always have CARGO_INCREMENTAL set without getting unexpected
+        // errors on stable/beta builds.
+        let incremental_enabled = incremental_enabled
+            && config.rustc()?.verbose_version.contains("nightly");
+
         Ok(Context {
             ws: ws,
             host: host_layout,